package com.macro.mall.model;

import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * mbr_member_video实体类
 *
 * @author gaodx
 *
 */
@Data
public class MbrMemberVideo implements Serializable{
	/**主键*/
    @ApiModelProperty(value = "主键")
	private Long id; 
	/**会员标识*/
    @ApiModelProperty(value = "会员标识")
	private Long memberId; 
	/**1-课程、2-视频、3-文章等等。目前 类型为2*/
    @ApiModelProperty(value = "1-课程、2-视频、3-文章等等。目前 类型为2")
	private Integer targetType; 
	/**如视频上级为课程，记录课程ID*/
    @ApiModelProperty(value = "如视频上级为课程，记录课程ID")
	private Long targetPid; 
	/**当目标类型为2时，记录视频id*/
    @ApiModelProperty(value = "当目标类型为2时，记录视频id")
	private Long targetId; 
	/***/
    @ApiModelProperty(value = "")
	private Date createTime; 
	/**1,有效，2.无效 */
    @ApiModelProperty(value = "1,有效，2.无效 ")
	private Integer status; 
	/**
	 * 实例化
	 */
	public MbrMemberVideo() {
		super();
	}
	/**
	 * 实例化
	 * 
	 * @param obj
	 */

	public MbrMemberVideo(JSONObject obj) {
		this();
		if (obj.get("id") instanceof Number) {
			this.setId(((Number) obj.get("id")).longValue());
		}
		if (obj.get("memberId") instanceof Number) {
			this.setMemberId(((Number) obj.get("memberId")).longValue());
		}
		if (obj.get("targetType") instanceof Number) {
			this.setTargetType(((Number) obj.get("targetType")).intValue());
		}
		if (obj.get("targetPid") instanceof Number) {
			this.setTargetPid(((Number) obj.get("targetPid")).longValue());
		}
		if (obj.get("targetId") instanceof Number) {
			this.setTargetId(((Number) obj.get("targetId")).longValue());
		}
		this.setCreateTime((Date) obj.get("createTime"));
		if (obj.get("status") instanceof Number) {
			this.setStatus(((Number) obj.get("status")).intValue());
		}
	}
	
	/**
	 * 将当前对象转换为JsonObject
	 * 
	 * @return
	 */
	public JSONObject toJson() {
		JSONObject result = new JSONObject();
		if (this.getId() != null) {
			result.put("id",this.getId());
		}
		if (this.getMemberId() != null) {
			result.put("memberId",this.getMemberId());
		}
		if (this.getTargetType() != null) {
			result.put("targetType",this.getTargetType());
		}
		if (this.getTargetPid() != null) {
			result.put("targetPid",this.getTargetPid());
		}
		if (this.getTargetId() != null) {
			result.put("targetId",this.getTargetId());
		}
		if (this.getCreateTime() != null) {
			result.put("createTime",this.getCreateTime());
		}
		if (this.getStatus() != null) {
			result.put("status",this.getStatus());
		}
		return result;
	}


	@Override
	public String toString() {
		return "MbrMemberVideo [id=" + id + " , memberId=" + memberId + " , targetType=" + targetType + " , targetPid=" + targetPid + " , targetId=" + targetId + " , createTime=" + createTime + " , status=" + status + "  ]";
	
	}
	
	
}
